home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr25 / os2cop21.zip / OS2COPY.CMD < prev    next >
OS/2 REXX Batch file  |  1993-04-28  |  10KB  |  21 lines

  1. /*
  2. ┌───────────────────────────────────────────────────────────────────────┐
  3. │ OS2Copy.CMD v. 2.1  part 1 of 2.                                      │
  4. │ REXX script to copy OS/2 HPFS or FAT BootManager system,              │
  5. │ from one drive letter to another  eg. from D: to E:,                  │
  6. │ from FAT to FAT, HPFS to HPFS, part 1.                                │
  7. │                                                                       │
  8. │ Documentation is found in the file OS2COPY.DOC                        │
  9. │                                                                       │
  10. │ Copyright (C): John Ståhle                                            │
  11. │                289A Buddinge Hovedgade                                │
  12. │                DK-2880 Bagsværd                                       │
  13. │                Denmark, Europe                                        │
  14. │                Phone +45 44 98 66 18                                  │
  15. │                                                                       │
  16. │ Disclaimer, warning and what not:                                     │
  17. │ !! NO responsibility or any other obligation you can ever think of    │
  18. │    is assumed, honored or anything else.                              │
  19. └───────────────────────────────────────────────────────────────────────┘
  20. */
  21. /*───────────────────────────────────────────────────────────────────────*/;Call RxFuncAdd SysLoadFuncs, RexxUtil, SysLoadFuncs;CALL SysLoadFuncs;PARSE UPPER Arg all_args;'@ECHO OFF';CALL SysCls;CALL Startmeddelelse;CALL FindFiler;CALL GetYesNo;CALL SysCls;CALL HentParametre;CALL SysCls;IF (FromDrive==ToDrive) THEN DO;SAY 'FromDrive ('FromDrive') is the same as ToDrive ('ToDrive') NO GO!';'PAUSE';CALL SysCls;CALL HentParametre;IF (FromDrive==ToDrive) THEN EXIT;CALL SysCls;END;CALL Kopimeddelelse;IF (OK \= YesLetter) THEN EXIT;CALL SysCls;/* Here goes */;CALL CreateStartupFile;CALL FdiskMsg;'Pause';'FDISK';CALL KaldOS2Copy2;EXIT;/*───────────────────────────────────────────────────────────────────────*/;Startmeddelelse:;SAY '┌────────────────────────────────────────────────────────────────────────┐';SAY '│ OS2Copy.1 v.2.01 Beta, Copyright John Ståhle(C)                        │';SAY '│                                                                        │';SAY '│ !!! No other process may be active while this job is running !!!       │';SAY '│                                                                        │';SAY '│ You will get messages telling that OS2.INI, OS2SYS.INI and SWAPPER.DAT │';SAY "│ can NOT be copied (this is during the XCOPY part) - don't worry,       │";SAY '│ these files will be copied and edited later in the process.            │';SAY '├────────────────────────────────────────────────────────────────────────┤';SAY '│             Press Control C  to STOP  - or                             │';SAY '└────────────────────────────────────────────────────────────────────────┘';SAY ;'PAUSE';RETURN;/*.......................................................................*/;FindFiler:;;CopyFil = 'OS2COPY2.CMD';Os2Copy2Fil = SysSearchPath('PATH',CopyFil);IF (Os2Copy2Fil=='') then DO;NoFileName = CopyFil;CALL FileNotThere;EXIT;END;CInitExe = 'InitEdit.EXE';InitEditExe = SysSearchPath('PATH',CInitExe);IF (InitEditExe=='') then DO;NoFileName = CInitExe;CALL FileNotThere;EXIT;END;YNFile = 'YesNo.LNG';YesNoFile = SysSearchPath('PATH',YNFile);IF (YesNoFile=='') then DO;NoFileName = YNFile;CALL FileNotThere;EXIT;END;;CListe = 'InitEdit.Lst';CInitList = SysSearchPath('PATH',CListe);IF (CInitList=='') then DO;NoFileName = CListe;CALL FileNotThere;EXIT;END;FraDrev = SUBSTR(DIRECTORY(),1,2);InitFil = LineIn(CInitList,1,1);DO WHILE InitFil  \=  '>INIT_FILES';InitFil = LineIn(CInitList);END;InitFil = LineIn(CInitList);DO WHILE ((InitFil \= '>BIN_FILES') & (LEFT(InitFil,1)=='\'));IndIni    = Substr(InitFil,2,LENGTH(InitFil)-1);CInitTest = SysSearchPath('PATH',IndIni);IF (CInitTest=='') then DO;NoFileName = IndIni;CALL FileNotFound;END;InitFil = LineIn(CInitList);END;CALL LineOut(CInitList);DROP CInitList;RETURN;/*.......................................................................*/;FileNotThere:;SAY '┌───────────────────────────────────────────────────────────────────┐';SAY '│' NoFileName' was >> NOT <<  found in your path';SAY '│' NoFileName' is crucial for the success of this procedure';SAY '│ !!! Path to 'NoFileName' must be included in your Config.Sys   !!!';SAY '│ !!! Path to 'NoFileName' must be included in your Autoexec.Bat !!!';SAY '└───────────────────────────────────────────────────────────────────┘';RETURN;/*.......................................................................*/;FileNotFound:;SAY '┌─────────────────────────────────────────────────────────────────┐';SAY '│ 'NoFileName' was >> NOT <<  found in your path';SAY '│                                                                 │';SAY '│ Place this (and the other files listed in 'CInitList')    │';SAY '│ in your PATH - or make sure these files are not needed          │';SAY '│ for your setup, in which case you must remove them from         │';SAY '│ 'CInitList' (a file like PMDIARY.INI may not be in use)   │';SAY '│                                                                 │';SAY '│ You can start another thread and make the changes now.          │';SAY '└─────────────────────────────────────────────────────────────────┘';'PAUSE';RETURN;/*.......................................................................*/;GetYesNo:;YesNo = ' ';DO WHILE (SubStr(YesNo,2,1) \= '/');YesNo = LineIn(YesNoFile);END;YesLetter = SubStr(YesNo,1,1);NoLetter  = SubStr(YesNo,3,1);IF (YesLetter == ' ') THEN YesLetter = 'Y';IF (NoLetter  == ' ') THEN NoLetter  = 'N';CALL LineOut(YesNoFile);RETURN;/*.......................................................................*/;HentParametre:;ArgNo = 1;IF (word(all_args,ArgNo)=='') THEN DO;SAY 'OS2Copy <FromDrive>: [<ToDrive>:]';SAY;SAY ' <FromDrive>:        Partition with OS/2 installed.';SAY ;SAY ' <ToDrive>:          Partition OS/2 is to be copied to,';SAY '                     OPTIONAL in this script.';SAY ;END;CALL HentFraParametre;CALL HentTilParametre;RETURN;/*.......................................................................*/;HentFraParametre:;k=SysCurPos();FromDrive=word(all_args,ArgNo);DO WHILE (FromDrive=='');CALL SysCurPos word(k,1), 0;SAY 'Partition to copy OS/2 system FROM (X:) ?';CALL SysCurPos word(k,1), 48;PULL FromDrive;END;IF (SUBSTR(FromDrive,2,1)<>':') THEN FromDrive = FromDrive':';RETURN;/*.......................................................................*/;HentTilParametre:;ArgNo   = ArgNo + 1;ToDrive = word(all_args,ArgNo);k       = SysCurPos();IF (ToDrive=='') THEN DO;CALL SysCurPos word(k,1), 0;SAY 'Partition to copy your OS/2 system TO (X:) ?';SAY '(OPTIONAL in this script).';CALL SysCurPos word(k,1), 48;PULL ToDrive ;END;IF (ToDrive\='') THEN DO;IF (SUBSTR(ToDrive,2,1)<>':') THEN DO;ToDrive = ToDrive':';END;END;IF (ToDrive == '') THEN ToDrive  = ' ';;CALL SysCurPos word(k,1), 0;SAY 'Partition to copy OS/2 system   TO = 'ToDrive;RETURN;/*.......................................................................*/;Kopimeddelelse:;SAY '┌─────────────────────────────────────────┐';SAY '│ Copying OS/2 FROM 'FromDrive'                    │';SAY '└─────────────────────────────────────────┘';IF (ToDrive\='') THEN DO;SAY '┌─────────────────────────────────────────┐';SAY '│ Copying OS/2   TO 'ToDrive'                    │';SAY '└─────────────────────────────────────────┘';END;k=SysCurPos();DO WHILE ((OK<>YesLetter) & (OK<>NoLetter));CALL SysCurPos word(k,1),0;SAY '┌─────────────────────────────────────────┐';SAY '│ Are you sure ('YesNo') ?                    │';SAY '└─────────────────────────────────────────┘';CALL SysCurPos word(k,1)+1,24;PULL OK;END;RETURN;/*.......................................................................*/;CreateStartupFile:;SAY '┌────────────────────────────────────────────────────────────┐';SAY '│ SYSxxxx: The system cannot find the file specified.        │';SAY '│                     is  OK                                 │';SAY '└────────────────────────────────────────────────────────────┘';FromDrive;'DEL 'FromDrive'StartUp.@#@';'REN 'FromDrive'\Startup.Cmd StartUp.@#@';StartFile=FromDrive'\Startup.Cmd';CALL lineout StartFile, '@Echo OFF',1;IF (Todrive\=' ') THEN DO;CALL lineout StartFile, 'OS2Copy2 'FromDrive' 'Todrive' 'CInitList;END;ELSE DO;CALL lineout StartFile, 'OS2Copy2 'FromDrive;END;CALL lineout StartFile, 'EXIT';k=lineout(StartFile);DROP StartFile;RETURN;/*.......................................................................*/;KaldOS2Copy2:;IF (Todrive\=' ') THEN DO;CALL OS2Copy2' 'FromDrive' 'Todrive' 'CInitList;END;ELSE DO;CALL  OS2Copy2' 'FromDrive;END;RETURN;/*.......................................................................*/;FdiskMsg:;SAY;SAY '┌────────────────────────────────────────────────────────────┐';SAY '│ SYSxxxx: The specified disk or diskette cannot be accessed │';SAY '│                           is  OK                           │';SAY '└────────────────────────────────────────────────────────────┘';SAY;SAY '┌────────────────────────────────────────────────────────────┐';SAY '│ Now starting FDISK                                         │';SAY '│ IF you are copying TO disk 1 of another computer then      │';SAY '│    Remember to create 'ToDrive' as a PRIMARY partition            │';SAY '│ ELSE if you are copying from one partition to another      │';SAY '│    Remember to create 'ToDrive' as a LOGICAL partition            │';SAY '│                                                            │';SAY '│ Insert the partition you created in BootManager            │';SAY '├────────────────────────────────────────────────────────────┤';SAY '│             Press Control C  to STOP  - or                 │';SAY '└────────────────────────────────────────────────────────────┘';SAY;RETURN;/*───────────────────────────────────────────────────────────────────────*/;